﻿$(document).ready(function () {
    $.get("../../Home/GetCateGory", function (data)
    {
        let str = "<ul>";
        for (var i = 0; i < data.length; i++) {
            str += "<li><a href='../../Home/CateGory/" + data[i].id + "'>" + data[i].title + "</a></li>";
        }
        str += "</ul>";
        $(".BigCg").html(str);

        $.get("", {cgId: @id}, function (data)
        {
            console.log(data);
        });

    }, "json");

    

    $.get("../../Home/GetArticle", function (data)
    {
        $(".article-c").empty();
        let str = "";
        for (var i = 0; i < data.length; i++) {

            str += "<div class='col-md-12' style='padding: 0; border-bottom: solid 1px #E8E8ED;'>";
            str += "<div class='article-box'>";

            str += "<a href='../../Home/Article/" + data[i].id +"' class='article-title-link'>";
            str += "<div class='article-title'>";
            str += "<span>" + data[i].title + "</span>";
            str += "</div>";
            str += "</a>";

            str += "<a href='../../Home/Article/" + data[i].id +"' class='article-details-link'>";
            str += "<div class='row'>";
            str += "<div class='col-md-2'>";
            str += "<img src='../../../Web/Cover/" + data[i].photo +"' alt='' width='160px' height='100px'>";
            str += "</div>";

            str += "<div class='col-md-10' style='padding: 0;'>";
            str += "<div class='article-details'>";
            str += "<div class='col-md-10' style='padding: 0; '>";
            str += "<span>"+ data[i].context +"</span>";
            str += "</div>";
            str += "</div>";
            str += "</div>";
            str += "</div>";
            str += "</a>";

            str += "<a href='javascript:void(0);' class='article-details-link'>";
            str += "<div class='userbox'>";
            str += "<div class='userinfo'>";

            str += "<div>";
            str += "<img src='Image/userLike.png' alt=''>";
            str += "<span>" + data[i].like +" &nbsp;赞</span>";
            str += "</div>";

            str += "<div>";
            str += "<img src='Image/userLike.png' alt=''>";
            str += "<span>" + data[i].trample + " &nbsp;踩</span>";
            str += "</div>";

            str += "<div>";
            str += "<span>" + data[i].author + "</span>";
            str += "</div>";

            str += "</div>";
            str += "</div>";

            str += "</div>";
            str += "</div>";
        }

        $(".article-c").html(str);

    }, "json");
});